<?php

class HealingtourController extends CController
{
	private $_tourTypeId = 1;
	
	public function actionIndex()
	{
		$this->setPageTitle('Лечебные туры');
		
		$records = Tour::model()->criteria('title', 'asc')->findAll('tourTypeId=:tourTypeId', array(':tourTypeId' => $this->_tourTypeId));
		$count   = count($records);
		
		$this->render('list', array(
			'entity' => 'tour',
			'data'   => $records,
			'count'  => $count,
			'detailedUrl' => '/healingtour/detailed/id/' 
		));
	}
	
	public function actionDetailed()
	{
		$tourId = intval($_GET['id']);
		
		if ($tourId > 0) {
			$tour = Tour::model()->with(array('attractions'))->findByPk($tourId);
			
			$this->setPageTitle($tour->title);
			
			$this->render('detailed', array(
				'tour' => $tour
			));
		}
	}
}